package com.facade;
 
import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;

import com.dao.UserDAO;
import com.model.User;
 
@Stateless
public class UserFacadeImp implements UserFacade {
 
	private User user;
    @EJB
    private UserDAO userDAO;
 
    public User findUserByLogin(String login) {
        return userDAO.findUserByLogin(login);
    }
    

	@Override
	public void saveUser(User user) {
		user.setIsConnected(false);
		userDAO.save(user);		
	}


	public User getUser() {
		return user;
	}


	public void setUser(User user) {
		this.user = user;
	}


	@Override
	public void deleteUser(User user) {
		userDAO.delete(user);
		
	}


	@Override
	public User updateUser(User user) {		
		return userDAO.update(user);
	}


	public List<User> showAllUsers() {		
		return userDAO.findAll();
	}
}